Skip to content

Conversation

@Berrysoft
Copy link
Member

No description provided.

@Berrysoft Berrysoft requested a review from Copilot January 28, 2026 16:25
@Berrysoft Berrysoft self-assigned this Jan 28, 2026
@Berrysoft Berrysoft added bug Something isn't working package: driver Related to compio-driver labels Jan 28, 2026
@Berrysoft Berrysoft closed this Jan 28, 2026
@Berrysoft Berrysoft deleted the unsafe-opcode branch January 28, 2026 16:26
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request converts the OpCode trait from a regular trait to an unsafe trait across different system implementations (IOCP, io-uring, polling, stub, and fusion). The changes update the trait definitions and some (but not all) implementations to use the unsafe keyword.

Changes:

  • Modified OpCode trait definitions to be unsafe trait in multiple platform-specific modules
  • Updated specific non-generic OpCode implementations to use unsafe impl (e.g., OpenFile, CloseFile, PathStat, various filesystem operations)
  • Left many generic implementations unchanged (without unsafe keyword)

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
compio-runtime/tests/event.rs Updated WaitEvent OpCode implementation to unsafe
compio-process/src/windows.rs Updated WaitProcess OpCode implementation to unsafe
compio-driver/src/sys/stub/op.rs Made trait unsafe and updated several specific implementations, but missed generic ones
compio-driver/src/sys/stub/mod.rs Changed OpCode trait definition to unsafe
compio-driver/src/sys/poll/op.rs Updated specific OpCode implementations to unsafe
compio-driver/src/sys/poll/mod.rs Changed OpCode trait definition to unsafe
compio-driver/src/sys/iour/op.rs Updated specific OpCode implementations to unsafe
compio-driver/src/sys/iour/mod.rs Changed OpCode trait definition to unsafe
compio-driver/src/sys/iocp/op.rs Updated CloseFile and CloseSocket to unsafe
compio-driver/src/sys/iocp/mod.rs Changed OpCode trait definition to unsafe with safety documentation
compio-driver/src/sys/fusion/mod.rs Changed OpCode trait definition to unsafe but missed blanket impl

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -96,21 +96,21 @@ impl<T: IoVectoredBuf, S: AsFd> OpCode for WriteVectored<T, S> {}

impl<S: AsFd> OpCode for Sync<S> {}
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation of the unsafe trait OpCode must be marked with unsafe. Change this to: unsafe impl<S: AsFd> OpCode for Sync {}

Suggested change
impl<S: AsFd> OpCode for Sync<S> {}
unsafe impl<S: AsFd> OpCode for Sync<S> {}

Copilot uses AI. Check for mistakes.
impl OpCode for CreateSocket {}
unsafe impl OpCode for CreateSocket {}

impl<S: AsFd> OpCode for ShutdownSocket<S> {}
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation of the unsafe trait OpCode must be marked with unsafe. Change this to: unsafe impl<S: AsFd> OpCode for ShutdownSocket {}

Suggested change
impl<S: AsFd> OpCode for ShutdownSocket<S> {}
unsafe impl<S: AsFd> OpCode for ShutdownSocket<S> {}

Copilot uses AI. Check for mistakes.
Comment on lines 115 to 116
impl<S: AsFd> OpCode for Accept<S> {}

Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These implementations of the unsafe trait OpCode must be marked with unsafe. Change to: unsafe impl<S: AsFd> OpCode for Accept {} and unsafe impl<S: AsFd> OpCode for Connect {}

Copilot uses AI. Check for mistakes.
pub trait OpCode: PollOpCode + IourOpCode {}
pub unsafe trait OpCode: PollOpCode + IourOpCode {}

impl<T: PollOpCode + IourOpCode + ?Sized> OpCode for T {}
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This blanket implementation must be marked as unsafe since it implements the unsafe trait OpCode. Change this to: unsafe impl<T: PollOpCode + IourOpCode + ?Sized> OpCode for T {}

Suggested change
impl<T: PollOpCode + IourOpCode + ?Sized> OpCode for T {}
unsafe impl<T: PollOpCode + IourOpCode + ?Sized> OpCode for T {}

Copilot uses AI. Check for mistakes.
impl OpCode for CloseFile {}
unsafe impl OpCode for CloseFile {}

impl<S: AsFd> OpCode for TruncateFile<S> {}
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation of the unsafe trait OpCode must be marked with unsafe. Change this to: unsafe impl<S: AsFd> OpCode for TruncateFile {}

Suggested change
impl<S: AsFd> OpCode for TruncateFile<S> {}
unsafe impl<S: AsFd> OpCode for TruncateFile<S> {}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working package: driver Related to compio-driver

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant